From aa966c2969b566026a752ba9a59a91a9380e9e7c Mon Sep 17 00:00:00 2001 From: "cl349@freefall.cl.cam.ac.uk" Date: Thu, 29 Jul 2004 14:48:40 +0000 Subject: [PATCH] bitkeeper revision 1.1108.38.2 (41090e48fvpT3Gg3-wliILln5YL7nQ) - share more files with linux 2.6 - always link 2.4 to linux-xen-sparse --- .rootkeys | 3 - Makefile | 4 +- .../arch/xen/drivers/dom0/core.c | 233 ------------------ .../arch/xen/lib/xen_proc.c | 18 -- .../include/asm-xen/xen_proc.h | 13 - linux-2.4.26-xen-sparse/mkbuildtree | 4 + 6 files changed, 7 insertions(+), 268 deletions(-) delete mode 100644 linux-2.4.26-xen-sparse/arch/xen/drivers/dom0/core.c delete mode 100644 linux-2.4.26-xen-sparse/arch/xen/lib/xen_proc.c delete mode 100644 linux-2.4.26-xen-sparse/include/asm-xen/xen_proc.h diff --git a/.rootkeys b/.rootkeys index 739f8f7f5b..6f89582d4b 100644 --- a/.rootkeys +++ b/.rootkeys @@ -63,7 +63,6 @@ 4075806dibjCcfuXv6CINMhxWTw3jQ linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/frontend/vbd.c 3e5a4e65G3e2s0ghPMgiJ-gBTUJ0uQ linux-2.4.26-xen-sparse/arch/xen/drivers/console/Makefile 3e5a4e656nfFISThfbyXQOA6HN6YHw linux-2.4.26-xen-sparse/arch/xen/drivers/dom0/Makefile -3e5a4e65BXtftInNHUC2PjDfPhdZZA linux-2.4.26-xen-sparse/arch/xen/drivers/dom0/core.c 40420a6ebRqDjufoN1WSJvolEW2Wjw linux-2.4.26-xen-sparse/arch/xen/drivers/evtchn/Makefile 40420a73Wou6JlsZDiu6YwjYomsm7A linux-2.4.26-xen-sparse/arch/xen/drivers/evtchn/evtchn.c 4083dc16-Kd5y9psK_yk161sme5j5Q linux-2.4.26-xen-sparse/arch/xen/drivers/netif/Makefile @@ -91,7 +90,6 @@ 3e5a4e66aHCbQ_F5QZ8VeyikLmuRZQ linux-2.4.26-xen-sparse/arch/xen/kernel/traps.c 3e5a4e66-9_NczrVMbuQkoSLyXckIw linux-2.4.26-xen-sparse/arch/xen/lib/Makefile 3e5a4e6637ZDk0BvFEC-aFQs599-ng linux-2.4.26-xen-sparse/arch/xen/lib/delay.c -3f68905cF5i8-NYpIhGjKmh0y8Gu5g linux-2.4.26-xen-sparse/arch/xen/lib/xen_proc.c 3e5a4e66croVgpcJyJuF2ycQw0HuJw linux-2.4.26-xen-sparse/arch/xen/mm/Makefile 3e5a4e66l8Q5Tv-6B3lQIRmaVbFPzg linux-2.4.26-xen-sparse/arch/xen/mm/fault.c 3e5a4e668SE9rixq4ahho9rNhLUUFQ linux-2.4.26-xen-sparse/arch/xen/mm/hypervisor.c @@ -133,7 +131,6 @@ 4062f7e2PzFOUGT0PaE7A0VprTU3JQ linux-2.4.26-xen-sparse/include/asm-xen/synch_bitops.h 3e5a4e68mTr0zcp9SXDbnd-XLrrfxw linux-2.4.26-xen-sparse/include/asm-xen/system.h 3f1056a9L_kqHcFheV00KbKBzv9j5w linux-2.4.26-xen-sparse/include/asm-xen/vga.h -3f689063nhrIRsMMZjZxMFk7iEINqQ linux-2.4.26-xen-sparse/include/asm-xen/xen_proc.h 40659defgWA92arexpMGn8X3QMDj3w linux-2.4.26-xen-sparse/include/asm-xen/xor.h 3f056927gMHl7mWB89rb73JahbhQIA linux-2.4.26-xen-sparse/include/linux/blk.h 41051ec1m6bJVjZocTG0C0V0O6RsVg linux-2.4.26-xen-sparse/include/linux/blkdev.h diff --git a/Makefile b/Makefile index 30fcc2b7dd..da23ca2a61 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,8 @@ dist: all LINUX_RELEASE ?= 2.4 LINUX_VER ?= $(shell ( /bin/ls -ld linux-$(LINUX_RELEASE).*-xen-sparse ) 2>/dev/null | \ sed -e 's!^.*linux-\(.\+\)-xen-sparse!\1!' ) +LINUX24_VER ?= $(shell ( /bin/ls -ld linux-2.4.*-xen-sparse ) 2>/dev/null | \ + sed -e 's!^.*linux-\(.\+\)-xen-sparse!\1!' ) LINUX_CONFIG_DIR ?= $(INSTALL_DIR)/boot LINUX_SRC_PATH ?= .:.. LINUX_SRC ?= $(firstword $(foreach dir,$(subst :, ,$(LINUX_SRC_PATH)),\ @@ -129,7 +131,7 @@ mrproper: clean rm -rf install/* patches $(LINUX_TREES) linux-$(LINUX_VER).tar.* make-symlinks: delete-symlinks - ln -sf linux-$(LINUX_VER)-xen-sparse linux-xen-sparse + ln -sf linux-$(LINUX24_VER)-xen-sparse linux-xen-sparse delete-symlinks: $(RM) linux-xen-sparse diff --git a/linux-2.4.26-xen-sparse/arch/xen/drivers/dom0/core.c b/linux-2.4.26-xen-sparse/arch/xen/drivers/dom0/core.c deleted file mode 100644 index 99f84d99fd..0000000000 --- a/linux-2.4.26-xen-sparse/arch/xen/drivers/dom0/core.c +++ /dev/null @@ -1,233 +0,0 @@ -/****************************************************************************** - * core.c - * - * Interface to privileged domain-0 commands. - * - * Copyright (c) 2002-2004, K A Fraser, B Dragovic - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -static struct proc_dir_entry *privcmd_intf; - -static int privcmd_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long data) -{ - int ret = -ENOSYS; - - switch ( cmd ) - { - case IOCTL_PRIVCMD_HYPERCALL: - { - privcmd_hypercall_t hypercall; - - if ( copy_from_user(&hypercall, (void *)data, sizeof(hypercall)) ) - return -EFAULT; - - __asm__ __volatile__ ( - "pushl %%ebx; pushl %%ecx; pushl %%edx; pushl %%esi; pushl %%edi; " - "movl 4(%%eax),%%ebx ;" - "movl 8(%%eax),%%ecx ;" - "movl 12(%%eax),%%edx ;" - "movl 16(%%eax),%%esi ;" - "movl 20(%%eax),%%edi ;" - "movl (%%eax),%%eax ;" - TRAP_INSTR "; " - "popl %%edi; popl %%esi; popl %%edx; popl %%ecx; popl %%ebx" - : "=a" (ret) : "0" (&hypercall) : "memory" ); - - } - break; - - case IOCTL_PRIVCMD_INITDOMAIN_EVTCHN: - { - extern int initdom_ctrlif_domcontroller_port; - ret = initdom_ctrlif_domcontroller_port; - } - break; - - - case IOCTL_PRIVCMD_MMAP: - { -#define PRIVCMD_MMAP_SZ 32 - privcmd_mmap_t mmapcmd; - privcmd_mmap_entry_t msg[PRIVCMD_MMAP_SZ], *p; - int i, rc; - - if ( copy_from_user(&mmapcmd, (void *)data, sizeof(mmapcmd)) ) - return -EFAULT; - - p = mmapcmd.entry; - - for (i=0; iPRIVCMD_MMAP_SZ)? - PRIVCMD_MMAP_SZ:(mmapcmd.num-i); - if ( copy_from_user(&msg, p, n*sizeof(privcmd_mmap_entry_t)) ) - return -EFAULT; - - for ( j = 0; j < n; j++ ) - { - struct vm_area_struct *vma = - find_vma( current->mm, msg[j].va ); - - if ( !vma ) - return -EINVAL; - - if ( msg[j].va > PAGE_OFFSET ) - return -EINVAL; - - if ( (msg[j].va + (msg[j].npages< vma->vm_end ) - return -EINVAL; - - if ( (rc = direct_remap_area_pages(vma->vm_mm, - msg[j].va&PAGE_MASK, - msg[j].mfn<vm_page_prot, - mmapcmd.dom)) < 0 ) - return rc; - } - } - ret = 0; - } - break; - - case IOCTL_PRIVCMD_MMAPBATCH: - { -#define MAX_DIRECTMAP_MMU_QUEUE 130 - mmu_update_t u[MAX_DIRECTMAP_MMU_QUEUE], *w, *v; - privcmd_mmapbatch_t m; - struct vm_area_struct *vma = NULL; - unsigned long *p, addr; - unsigned long mfn; - int i; - - if ( copy_from_user(&m, (void *)data, sizeof(m)) ) - { ret = -EFAULT; goto batch_err; } - - vma = find_vma( current->mm, m.addr ); - - if ( !vma ) - { ret = -EINVAL; goto batch_err; } - - if ( m.addr > PAGE_OFFSET ) - { ret = -EFAULT; goto batch_err; } - - if ( (m.addr + (m.num< vma->vm_end ) - { ret = -EFAULT; goto batch_err; } - - if ( m.dom != 0 ) - { - u[0].val = (unsigned long)(m.dom<<16) & ~0xFFFFUL; - u[0].ptr = (unsigned long)(m.dom<< 0) & ~0xFFFFUL; - u[0].ptr |= MMU_EXTENDED_COMMAND; - u[0].val |= MMUEXT_SET_SUBJECTDOM; - v = w = &u[1]; - } - else - { - v = w = &u[0]; - } - - p = m.arr; - addr = m.addr; - for ( i = 0; i < m.num; i++, addr += PAGE_SIZE, p++ ) - { - if ( get_user(mfn, p) ) - return -EFAULT; - - v->val = (mfn << PAGE_SHIFT) | pgprot_val(vma->vm_page_prot); - - __direct_remap_area_pages(vma->vm_mm, - addr, - PAGE_SIZE, - v); - - if ( unlikely(HYPERVISOR_mmu_update(u, v - u + 1, NULL) < 0) ) - put_user( 0xF0000000 | mfn, p ); - - v = w; - } - ret = 0; - break; - - batch_err: - printk("batch_err ret=%d vma=%p addr=%lx num=%d arr=%p %lx-%lx\n", - ret, vma, m.addr, m.num, m.arr, vma->vm_start, vma->vm_end); - break; - } - break; - - default: - ret = -EINVAL; - break; - } - return ret; -} - -static int privcmd_mmap(struct file * file, struct vm_area_struct * vma) -{ - /* DONTCOPY is essential for Xen as copy_page_range is broken. */ - vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY; - - return 0; -} - -static struct file_operations privcmd_file_ops = { - ioctl : privcmd_ioctl, - mmap: privcmd_mmap -}; - - -static int __init init_module(void) -{ - if ( !(start_info.flags & SIF_PRIVILEGED) ) - return 0; - - privcmd_intf = create_xen_proc_entry("privcmd", 0400); - if ( privcmd_intf != NULL ) - { - privcmd_intf->owner = THIS_MODULE; - privcmd_intf->nlink = 1; - privcmd_intf->proc_fops = &privcmd_file_ops; - } - - return 0; -} - - -static void __exit cleanup_module(void) -{ - if ( privcmd_intf == NULL ) return; - remove_xen_proc_entry("privcmd"); - privcmd_intf = NULL; -} - - -module_init(init_module); -module_exit(cleanup_module); -# diff --git a/linux-2.4.26-xen-sparse/arch/xen/lib/xen_proc.c b/linux-2.4.26-xen-sparse/arch/xen/lib/xen_proc.c deleted file mode 100644 index 9c06dcdd89..0000000000 --- a/linux-2.4.26-xen-sparse/arch/xen/lib/xen_proc.c +++ /dev/null @@ -1,18 +0,0 @@ - -#include -#include - -static struct proc_dir_entry *xen_base; - -struct proc_dir_entry *create_xen_proc_entry(const char *name, mode_t mode) -{ - if ( xen_base == NULL ) - if ( (xen_base = proc_mkdir("xen", &proc_root)) == NULL ) - panic("Couldn't create /proc/xen"); - return create_proc_entry(name, mode, xen_base); -} - -void remove_xen_proc_entry(const char *name) -{ - remove_proc_entry(name, xen_base); -} diff --git a/linux-2.4.26-xen-sparse/include/asm-xen/xen_proc.h b/linux-2.4.26-xen-sparse/include/asm-xen/xen_proc.h deleted file mode 100644 index d62791e95c..0000000000 --- a/linux-2.4.26-xen-sparse/include/asm-xen/xen_proc.h +++ /dev/null @@ -1,13 +0,0 @@ - -#ifndef __ASM_XEN_PROC_H__ -#define __ASM_XEN_PROC_H__ - -#include -#include - -extern struct proc_dir_entry *create_xen_proc_entry( - const char *name, mode_t mode); -extern void remove_xen_proc_entry( - const char *name); - -#endif /* __ASM_XEN_PROC_H__ */ diff --git a/linux-2.4.26-xen-sparse/mkbuildtree b/linux-2.4.26-xen-sparse/mkbuildtree index 7cdc0af60d..db4d7309d0 100755 --- a/linux-2.4.26-xen-sparse/mkbuildtree +++ b/linux-2.4.26-xen-sparse/mkbuildtree @@ -199,6 +199,7 @@ ln -sf ../asm-i386/ucontext.h ln -sf ../asm-i386/unaligned.h ln -sf ../asm-i386/unistd.h ln -sf ../asm-i386/user.h +ln -sf ../../${LINUX_26}/include/asm-xen/xen_proc.h cd ../../arch/xen/kernel ln -sf ../../i386/kernel/i387.c @@ -220,10 +221,13 @@ ln -sf ../../i386/lib/mmx.c ln -sf ../../i386/lib/old-checksum.c ln -sf ../../i386/lib/strstr.c ln -sf ../../i386/lib/usercopy.c +ln -sf ../../../${LINUX_26}/arch/xen/kernel/xen_proc.c cd ../mm ln -sf ../../i386/mm/extable.c ln -sf ../../i386/mm/pageattr.c cd ../drivers/console ln -sf ../../../../${LINUX_26}/drivers/xen/console/console.c +cd ../dom0 +ln -sf ../../../../${LINUX_26}/drivers/xen/privcmd/privcmd.c core.c cd ../netif/frontend ln -sf ../../../../../${LINUX_26}/drivers/xen/net/network.c main.c -- 2.30.2